/*
 * @Description: 协议store
 * @Author: zhangwei
 * @Date: 2023-02-03 16:18:52
 * @LastEditTime: 2023-02-19 12:18:03
 * @LastEditors: zw 775925302@qq.com
 */
import { ref, computed, reactive } from "vue";
import { defineStore } from "pinia";
import { deepClone, generateId, isEmpty } from "@/utils/StrUtil";
import CmpConfig from "@/components-designer/indexCmpConfig";

/**
 *  设计器对象
 */
export const designer = defineStore("designer", () => {


  function changeAttrFunc(key: string, value: any) {
    // protocal.attrs.value = value;
  }

  // function changeFormEntityFieldsToWidgets(mdata: any, fields: EntityType[]) {
  //   fields.forEach((v) => {
  //     var attr = {
  //       id: generateId(),
  //       component: v.component,
  //       category: "form",
  //     };
  //     var newAttr = Object.assign(attr, getWidgetCloneObj(attr.component))
  //     mdata.widgetList.push(newAttr);
  //   });
  // }

  function getWidgetCloneObj(cmpName: string) {
    return deepClone(CmpConfig[cmpName]);
  }

  return {getWidgetCloneObj};
});
